package org.anq.ddm.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

@Configuration
@EnableSwagger2
public class knife4jConfig {

    @Bean(value="defaultApi2")
    public Docket defaultApi2(){
        String groupName = "1.0版本";
        Docket docket = new Docket(DocumentationType.OAS_30)
                .apiInfo(new ApiInfoBuilder()
                        .title("低代码平台 API")
                        .description("2023年，前后端分离，camunda 流程引擎， 敏捷开发， 容器架构部署。")
                        .termsOfServiceUrl("http://xxx.xxx.org")
                        .contact(new Contact("dev", "http://dev.xxx.org", "dev@xxx.org"))
                        .version("1.0")
                        .build())
                .groupName(groupName)
                .select()
                .apis(RequestHandlerSelectors.basePackage("org.anq.ddm.controller"))
                .paths(PathSelectors.any())
                .build();
        return docket;
    }

    private ApiInfo adminApiInfo() {
        return new ApiInfoBuilder()
                .title("低代码平台")
                .version("1.0")
                .contact(new Contact("dev", "http://dev.xxx.org", "dev@xxx.org"))
                .build();
    }

}
